home *** CD-ROM | disk | FTP | other *** search
/ Champak 145 / (Vol 145) Dec 21 2011.iso / Games / hearts.swf / scripts / DefineSprite_568 / frame_2 / DoAction.as
Encoding:
Text File  |  2011-12-21  |  4.4 KB  |  208 lines

  1. letterkeys = new Array("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z");
  2. numberkeys = new Array("0","1","2","3","4","5","6","7","8","9");
  3. numpadkeys = new Array("0","1","2","3","4","5","6","7","8","9","*","+","Enter","-",".","/");
  4. functionkeys = new Array("F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12");
  5. otherkeys = new Array("Space","Page Up","Page Down","End","Home","Left","Up","Right","Down");
  6. this.setValues = function(pressed, which)
  7. {
  8.    var p = this;
  9.    if(pressed >= 65 and pressed <= 90)
  10.    {
  11.       p[which] = letterkeys[pressed - 65];
  12.    }
  13.    if(pressed >= 48 and pressed <= 57)
  14.    {
  15.       p[which] = numberkeys[pressed - 48];
  16.    }
  17.    if(pressed >= 96 and pressed <= 111)
  18.    {
  19.       p[which] = numpadkeys[pressed - 96];
  20.    }
  21.    if(pressed >= 112 and pressed <= 123)
  22.    {
  23.       p[which] = functionkeys[pressed - 112];
  24.    }
  25.    if(pressed >= 32 and pressed <= 40)
  26.    {
  27.       p[which] = otherkeys[pressed - 32];
  28.    }
  29.    if(pressed == 8)
  30.    {
  31.       p[which] = "BackSpace";
  32.    }
  33.    if(pressed == 9)
  34.    {
  35.       p[which] = "Tab";
  36.    }
  37.    if(pressed == 12)
  38.    {
  39.       p[which] = "Clear";
  40.    }
  41.    if(pressed == 13)
  42.    {
  43.       p[which] = "Enter";
  44.    }
  45.    if(pressed == 16)
  46.    {
  47.       p[which] = "Shift";
  48.    }
  49.    if(pressed == 17)
  50.    {
  51.       p[which] = "Control";
  52.    }
  53.    if(pressed == 18)
  54.    {
  55.       p[which] = "Alt";
  56.    }
  57.    if(pressed == 20)
  58.    {
  59.       p[which] = "Caps Lock";
  60.    }
  61.    if(pressed == 27)
  62.    {
  63.       p[which] = "Esc";
  64.    }
  65.    if(pressed == 45)
  66.    {
  67.       p[which] = "Insert";
  68.    }
  69.    if(pressed == 46)
  70.    {
  71.       p[which] = "Delete";
  72.    }
  73.    if(pressed == 47)
  74.    {
  75.       p[which] = "help";
  76.    }
  77.    if(pressed == 144)
  78.    {
  79.       p[which] = "Num Lock";
  80.    }
  81.    if(pressed == 186)
  82.    {
  83.       p[which] = ";:";
  84.    }
  85.    if(pressed == 187)
  86.    {
  87.       p[which] = "=+";
  88.    }
  89.    if(pressed == 189)
  90.    {
  91.       p[which] = "-_";
  92.    }
  93.    if(pressed == 191)
  94.    {
  95.       p[which] = "/?";
  96.    }
  97.    if(pressed == 192)
  98.    {
  99.       p[which] = "\'@";
  100.    }
  101.    if(pressed == 219)
  102.    {
  103.       p[which] = "[{";
  104.    }
  105.    if(pressed == 220)
  106.    {
  107.       p[which] = "\\|";
  108.    }
  109.    if(pressed == 221)
  110.    {
  111.       p[which] = "]}";
  112.    }
  113.    p[which + "Name"].autoSize = true;
  114.    if(which == "mKey")
  115.    {
  116.       p.mStatInst._x = p[which + "Name"]._x + p[which + "Name"]._width + 20;
  117.    }
  118.    else if(which == "sKey")
  119.    {
  120.       p.sStatInst._x = p[which + "Name"]._x + p[which + "Name"]._width + 20;
  121.    }
  122.    p._parent.typing = false;
  123. };
  124. this.setValues(this._parent.uKey,"uKey");
  125. this.setValues(this._parent.dKey,"dKey");
  126. this.setValues(this._parent.pKey,"pKey");
  127. this.setValues(this._parent.mKey,"mKey");
  128. this.setValues(this._parent.sKey,"sKey");
  129. this.releaseFunc = function(which)
  130. {
  131.    var t = this;
  132.    t.fillBlanks();
  133.    t._parent.typing = true;
  134.    t.selectkey = true;
  135.    t.whichkey = which;
  136.    t[which] = "";
  137. };
  138. this.fillBlanks = function()
  139. {
  140.    var t = this;
  141.    if(t.selectkey == true)
  142.    {
  143.       if(t.whichkey == "uKey")
  144.       {
  145.          t.setValues(t._parent.uKey,"uKey");
  146.       }
  147.       if(t.whichkey == "dKey")
  148.       {
  149.          t.setValues(t._parent.dKey,"dKey");
  150.       }
  151.       if(t.whichkey == "pKey")
  152.       {
  153.          t.setValues(t._parent.pKey,"pKey");
  154.       }
  155.       if(t.whichkey == "mKey")
  156.       {
  157.          t.setValues(t._parent.mKey,"mKey");
  158.       }
  159.       if(t.whichkey == "sKey")
  160.       {
  161.          t.setValues(t._parent.sKey,"sKey");
  162.       }
  163.    }
  164. };
  165. this.uKeyInst.onRelease = function()
  166. {
  167.    this._parent.releaseFunc("uKey");
  168. };
  169. this.dKeyInst.onRelease = function()
  170. {
  171.    this._parent.releaseFunc("dKey");
  172. };
  173. this.pKeyInst.onRelease = function()
  174. {
  175.    this._parent.releaseFunc("pKey");
  176. };
  177. this.mKeyInst.onRelease = function()
  178. {
  179.    this._parent.releaseFunc("mKey");
  180. };
  181. this.sKeyInst.onRelease = function()
  182. {
  183.    this._parent.releaseFunc("sKey");
  184. };
  185. this.qual = this._parent.inGameQuality;
  186. this.part = this._parent.particles;
  187. this.setSoundText = function()
  188. {
  189.    if(this._parent.globalsoundcontrol == "play")
  190.    {
  191.       this.mStat = "(Currently On)";
  192.    }
  193.    else if(this._parent.globalsoundcontrol == "stop")
  194.    {
  195.       this.mStat = "(Currently Off)";
  196.    }
  197.    trace("options sound play: " + this._parent.soundPlay);
  198.    if(this._parent.soundPlay == "true")
  199.    {
  200.       this.sStat = "(Currently On)";
  201.    }
  202.    else
  203.    {
  204.       this.sStat = "(Currently Off)";
  205.    }
  206. };
  207. this.setSoundText();
  208.